home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_aet_gemdoor.cog < prev    next >
Text File  |  1999-11-15  |  11KB  |  383 lines

  1. # Jones 3D Cog Script
  2. #
  3. # aet_GemDoor.cog
  4. #
  5. # [TL]
  6. #
  7. #     This cog controls the placing of the three gems/keys in the Aetherium for the three main
  8. # doors in the boss area.  Places gems, and moves doors.  Also controls the first door for 
  9. # closing off access to bottom rooms.    
  10. #
  11. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  12. #
  13. # ========================================================================================
  14. symbols
  15.  
  16. message        startup
  17. message        activated
  18. message        arrived
  19. message        crossed
  20.  
  21. thing        player                            local
  22. thing        indy0                                    # Actor Indy0.
  23. thing        indy1                                    # Actor Indy1.
  24. thing        indy2                                    # Actor Indy2.
  25. thing        cam0                                    # Camera 0 for door 0.
  26. thing        cam1                                    # Camera 1 for door 1.
  27. thing        cam2                                    # Camera 2 for door 2.
  28. thing        cam_target0                                # Camera target for cam0.
  29. thing        cam_target1                                # Camera target for cam1.
  30. thing        cam_target2                                # Camera target for cam2.
  31.  
  32. thing        door0                                    # GemDoors themselves.
  33. thing        door1
  34. thing        door2
  35. thing        ghost0                                    # Ghost attached to first GemDoor.
  36.  
  37. thing        greenGem                                # Actual move item gems in doors.                                
  38. thing        redGem                                
  39. thing        blueGem                                
  40.  
  41. surface        adjoin0                                    # Cross this adjoin to close first door behind you.        
  42. surface        adjoin1                                    # Cross this adjoin to open first door if you need to.        
  43. surface        adjoinA                                    # Cross this adjoin to close first door behind you. 
  44.  
  45. sound        doorstart=aet_gemdoor_start.wav    local    # Gem door starting sound.        
  46. sound        doormove=aet_gemdoor_move.wav    local    # Gem door moving sound.        
  47. sound        doorstop=aet_gemdoor_stop.wav    local    # Gem door stoping sound.        
  48. sound        placeGem=aet_gem_place.wav        local    # Gem placement sound.        
  49.  
  50. int            done0=0                            local    # Int for toggle for crossed message in hallway.
  51. int            done1=0                            local    # Int for toggle for crossed message in hole.
  52. int            door0done=0                        local    # Ints for doors being opened with gems for good.    
  53. int            door1done=0                        local    
  54. int            door2done=0                        local    
  55. int            movechannel                        local    # Gem door0 channel.
  56. int            startchannel                    local    # Gem door0 channel.
  57. int            stopchannel                        local    # Gem door0 channel.
  58.  
  59. cog            doorTalk                                # Hal's door talk cog reference.
  60.  
  61. end
  62.  
  63. # ========================================================================================
  64. code
  65.  
  66. startup:
  67.  
  68. MoveToFrame(ghost0, 1, 1.0);
  69.  
  70. player = GetLocalPlayerThing();
  71. # Attatch first door to ghost0 so it may be rotated AND moved.
  72. AttachThingToThing(door0, ghost0);
  73. # Attach gems to doors.
  74. AttachThingToThing(greenGem, door0);
  75. AttachThingToThing(blueGem, door1);
  76. AttachThingToThing(redGem, door2);
  77. # Turn move item gems invisable.
  78. SetThingFlags(greenGem, 0x10);
  79. SetThingFlags(blueGem, 0x10);
  80. SetThingFlags(redGem, 0x10);
  81.  
  82. return;
  83.  
  84. # ........................................................................................
  85. crossed:
  86.  
  87. # Crossed to close door behind player once they enter boss room.
  88. if ((GetSenderRef() == adjoin0) || (GetSenderRef() == adjoinA))
  89.     {
  90.     if ((GetSourceRef() == player) && (done0 == 0) && (GetCurFrame(ghost0) == 1))
  91.         {
  92.         if (IsThingMoving(ghost0) == 1) return;
  93.         done0 = 1;
  94.         MoveToFrame(ghost0, 0, 2.0);
  95.         startchannel = PlaySoundThing(doorstart, door0, 1.0, -1, -1, 0);
  96.         movechannel = PlaySoundThing(doormove, door0, 1.0, -1, -1, 0x1);
  97.         done1 = 0;
  98.         }
  99.     }
  100. # Crossed to open door to allow entrance from above hallway and reset door.
  101. if ((GetSenderRef() == adjoin1) && (GetSourceRef() == player) && (done1 == 0) && (GetCurFrame(ghost0) == 0))
  102.     {
  103.     if (IsThingMoving(ghost0) == 1) return;
  104.     done1 = 1;
  105.     MoveToFrame(ghost0, 1, 2.0);
  106.     done0 = 0;
  107.     }
  108.  
  109. return;
  110.  
  111. # ........................................................................................
  112. activated:
  113.  
  114. if ((GetSenderRef() == door0) || (GetSenderRef() == door1) || (GetSenderRef() == door2) && (GetSourceRef() == player))
  115.     {
  116.     # Small cutscene for activating doors with no item.
  117.     if (MakeMeStop() == -1)
  118.         return;
  119.     DeselectWeaponWait(player);    
  120.     StartCutscene(0);
  121.     PlayMode(player, 60, 0);
  122.     SendMessageEx(doorTalk, user4, player, 0, 0, 0);
  123.     while (global15 == 0)
  124.         {
  125.         #Wait for line to finish...
  126.         Sleep(0.01);
  127.         }
  128.     ClearActorFlags(player, 0x200000);
  129.     EndCutscene();   
  130.     }
  131. # Code for first door recieving one of the gems and then opening this door.
  132. if ((GetSenderRef() == greenGem) && (GetSourceRef() == player))
  133.     {
  134.     if (door0done == 1)
  135.         {
  136.         return;
  137.         }
  138.     # Small cutscene for wrong trying wrong items.
  139.     if (GetCurItem(player) != 95)
  140.         {
  141.         if (MakeMeStop() == -1)
  142.             return;
  143.         DeselectWeaponWait(player);    
  144.         StartCutscene(0);    
  145.         PlayMode(player, 60, 0);
  146.         SendMessageEx(doorTalk, user3, player, 0, 0, 0);
  147.         while (global15 == 0)
  148.             {
  149.             #Wait for line to finish...
  150.             Sleep(0.01);
  151.             }
  152.         ClearActorFlags(player, 0x200000);
  153.         EndCutscene();   
  154.         }
  155.     if (GetCurItem(player) == 95)
  156.         {
  157.         door0done = 1;
  158.         # Green gem.
  159.         if (MakeMeStop() == -1)
  160.             return;
  161.         DeselectWeaponWait(player);    
  162.         StartCutscene(0);
  163.         SetThingFlags(player, 0x80000);
  164.         CopyPlayerHolsters(player, indy0);
  165.         ClearThingFlags(indy0, 0x80000);
  166.         SetCameraLookInterp(2, 0);
  167.         SetCameraPosInterp(2, 0);
  168.         # Cut to showing Indy place gem.
  169.         SetCameraFocus(2, cam0);
  170.         SetCameraSecondaryFocus(2, cam_target0);
  171.         // insert interp code here...
  172.         SetCurrentCamera(2);
  173.         SetCameraFOV(90, 0, 0.0);
  174.         
  175.         PlayMode(indy0, 60, 0);
  176.         
  177.         Sleep(0.5);
  178.         
  179.         # Make green gem visible.
  180.         ClearThingFlags(greenGem, 0x10);
  181.         PlaySoundThing(placeGem, greenGem, 1.0, -1, -1, 0);
  182.         ChangeInv(player, 95, -1);
  183.         Sleep(1.0);
  184.  
  185.         MoveToFrame(door0, 1, 1.0);
  186.         //startchannel = PlaySoundThing(doorstart, door0, 1.0, -1, -1, 0);
  187.         //movechannel = PlaySoundThing(doormove, door0, 1.0, -1, -1, 0x1);
  188.         }
  189.     }
  190. # Code for second door recieving one of the gems and then opening this door.
  191. if ((GetSenderRef() == blueGem) && (GetSourceRef() == player))
  192.     {
  193.     if (door1done == 1) 
  194.         {
  195.         return;
  196.         }
  197.     # Small cutscene for wrong trying wrong items.
  198.     if (GetCurItem(player) != 96)
  199.         {
  200.         if (MakeMeStop() == -1)
  201.             return;
  202.         DeselectWeaponWait(player);    
  203.         StartCutscene(0);    
  204.         PlayMode(player, 60, 0);
  205.         SendMessageEx(doorTalk, user3, player, 0, 0, 0);
  206.         while (global15 == 0)
  207.             {
  208.             #Wait for line to finish...
  209.             Sleep(0.01);
  210.             }
  211.         ClearActorFlags(player, 0x200000);
  212.         EndCutscene();   
  213.         }
  214.     if (GetCurItem(player) == 96)
  215.         {
  216.         door1done = 1;
  217.         # Blue gem.
  218.         if (MakeMeStop() == -1)
  219.             return;
  220.         DeselectWeaponWait(player);    
  221.         StartCutscene(0);
  222.         SetThingFlags(player, 0x80000);
  223.         CopyPlayerHolsters(player, indy1);
  224.         ClearThingFlags(indy1, 0x80000);
  225.         SetCameraLookInterp(2, 0);
  226.         SetCameraPosInterp(2, 0);
  227.         # Cut to showing Indy place gem.
  228.         SetCameraFocus(2, cam1);
  229.         SetCameraSecondaryFocus(2, cam_target1);
  230.         // insert interp code here...
  231.         SetCurrentCamera(2);
  232.         SetCameraFOV(90, 0, 0.0);
  233.         
  234.         PlayMode(indy1, 60, 0);
  235.         
  236.         Sleep(0.5);
  237.         
  238.         # Make blue gem visible.
  239.         ClearThingFlags(blueGem, 0x10);
  240.         PlaySoundThing(placeGem, blueGem, 1.0, -1, -1, 0);
  241.         ChangeInv(player, 96, -1);
  242.         Sleep(1.0);
  243.         MoveToFrame(door1, 1, 1.0);
  244.         }
  245.     }
  246.  
  247. # Code for third door recieving one of the gems and then opening this door.
  248. if ((GetSenderRef() == redGem) && (GetSourceRef() == player))
  249.     {
  250.     if (door2done == 1) 
  251.         {
  252.         return;
  253.         }
  254.     # Small cutscene for wrong trying wrong items.
  255.     if (GetCurItem(player) != 97)
  256.         {
  257.         if (MakeMeStop() == -1)
  258.             return;
  259.         DeselectWeaponWait(player);    
  260.         StartCutscene(0);    
  261.         PlayMode(player, 60, 0);
  262.         SendMessageEx(doorTalk, user3, player, 0, 0, 0);
  263.         while (global15 == 0)
  264.             {
  265.             #Wait for line to finish...
  266.             Sleep(0.01);
  267.             }
  268.         ClearActorFlags(player, 0x200000);
  269.         EndCutscene();   
  270.         }
  271.     if (GetCurItem(player) == 97)
  272.         {
  273.         door2done = 1;
  274.         # Red gem.
  275.         if (MakeMeStop() == -1)
  276.             return;
  277.         DeselectWeaponWait(player);    
  278.         StartCutscene(0);
  279.         SetThingFlags(player, 0x80000);
  280.         CopyPlayerHolsters(player, indy2);
  281.         ClearThingFlags(indy2, 0x80000);
  282.         SetCameraLookInterp(2, 0);
  283.         SetCameraPosInterp(2, 0);
  284.         # Cut to showing Indy place gem.
  285.         SetCameraFocus(2, cam2);
  286.         SetCameraSecondaryFocus(2, cam_target2);
  287.         // insert interp code here...
  288.         SetCurrentCamera(2);
  289.         SetCameraFOV(90, 0, 0.0);
  290.         
  291.         PlayMode(indy2, 60, 0);
  292.         
  293.         Sleep(0.5);
  294.         
  295.         # Make red gem visible.
  296.         ClearThingFlags(redGem, 0x10);
  297.         PlaySoundThing(placeGem, redGem, 1.0, -1, -1, 0);
  298.         ChangeInv(player, 97, -1);
  299.         Sleep(1.0);
  300.         MoveToFrame(door2, 1, 1.0);
  301.         }
  302.     }
  303.  
  304. return;
  305.  
  306. # ........................................................................................
  307. arrived:
  308.  
  309. # Code for turning off adjoins when doors are closed.
  310. if ((GetSenderRef() == ghost0) && (GetCurFrame(ghost0) == 0))
  311.     {
  312.     # Code for playing sounds on first door because the sound class is not being used.
  313.     StopSound(movechannel, 0);
  314.     PlaySoundThing(doorstop, door0, 1.0, -1, -1, 0);
  315.     }
  316. if ((GetSenderRef() == door0) && (GetCurFrame(door0) == 1))
  317.     {
  318.     //crosseddone = 1;
  319.     StopSound(movechannel, 0);
  320.     stopchannel = PlaySoundThing(doorstop, door0, 1.0, -1, -1, 0);
  321.     WaitForSound(stopchannel);
  322.     SendMessageEx(doorTalk, user1, indy0, 0, 0, 0);
  323.     while (global15 == 0)
  324.         {
  325.         #Wait for line to finish...
  326.         Sleep(0.01);
  327.         }
  328.     # Return to normal.
  329.     CopyOrientandPos(indy0, player);
  330.     SetCurrentCamera(1);
  331.     SetCameraFOV(90, 0, 0.0);
  332.     SetThingFlags(indy0, 0x80000);
  333.     ClearThingFlags(player, 0x80000);
  334.     ClearActorFlags(player, 0x200000);
  335.     EndCutScene();
  336.     }
  337. if ((GetSenderRef() == door1) && (GetCurFrame(door1) == 1))
  338.     {
  339.     Sleep(1.0);
  340.  
  341.     SendMessageEx(doorTalk, user1, indy1, 0, 0, 0);
  342.     while (global15 == 0)
  343.         {
  344.         #Wait for line to finish...
  345.         Sleep(0.01);
  346.         }
  347.     # Return to normal.
  348.     CopyOrientandPos(indy1, player);
  349.     SetCurrentCamera(1);
  350.     SetCameraFOV(90, 0, 0.0);
  351.     
  352.     SetThingFlags(indy1, 0x80000);
  353.     ClearThingFlags(player, 0x80000);
  354.     ClearActorFlags(player, 0x200000);
  355.     EndCutScene();
  356.     }
  357. if ((GetSenderRef() == door2) && (GetCurFrame(door2) == 1))
  358.     {
  359.     Sleep(1.0);
  360.  
  361.     SendMessageEx(doorTalk, user1, indy2, 0, 0, 0);
  362.     while (global15 == 0)
  363.         {
  364.         #Wait for line to finish...
  365.         Sleep(0.01);
  366.         }
  367.     # Return to normal.
  368.     CopyOrientandPos(indy2, player);
  369.     SetCurrentCamera(1);
  370.     SetCameraFOV(90, 0, 0.0);
  371.     
  372.     SetThingFlags(indy2, 0x80000);
  373.     ClearThingFlags(player, 0x80000);
  374.     ClearActorFlags(player, 0x200000);
  375.     EndCutScene();
  376.     }
  377.  
  378. return;
  379.  
  380. # ........................................................................................
  381. end
  382.  
  383.